﻿/*
 * StringBuffer.h
 *
 */
#ifndef __GDK_STRINGBUFFER_H__
#define __GDK_STRINGBUFFER_H__

#include <gdk/core/MemoryStream.h>


namespace gdk
{


	class GDK_CORE_EXPORT StringBuffer
	{
	private:
		MemoryStream::Handle  _buffer;

	public:
		StringBuffer(void);
		StringBuffer& operator <<(StringBuffer &buffer);
		operator String() const;

	private:
		__INLINE__ StringBuffer& append(const void *data, ssize_t size) { _buffer->write(data, size); return *this; }
	public:
		__INLINE__ StringBuffer& append(const Char *text) { return append(text, __strlen(text) * sizeof(Char)); }
		__INLINE__ StringBuffer& append(const String &text) { return append(text, text.getBufferLength() - sizeof(Char)); }
		__INLINE__ StringBuffer& operator <<(const Char *text) { return append(text, __strlen(text) * sizeof(Char)); }
		__INLINE__ StringBuffer& operator <<(const String &text) { return append(text, text.getBufferLength() - sizeof(Char)); }
	};



}//namespace gdk



#endif /*__GDK_STRINGBUFFER_H__*/
